﻿using System;
using System.Collections.Generic;
using System.Text;

using com.tiyma.model;

namespace com.tiyma.common
{
    public class Consts
    {
        /// <summary>
        /// 成功的
        /// </summary>
        public const int Successed = 0;

        /// <summary>
        /// 失败的
        /// </summary>
        public const int Failed = -1;

        public const string VifCode = "yc@!78k";

        public static DateTime MinValue = new DateTime(1954, 1, 1);

        public static DateTime MaxValue = new DateTime(9999, 1, 1);

        public enum SearchType
        {
            /// <summary>
            /// 书名
            /// </summary>
            BookName=1,
            /// <summary>
            /// 作者
            /// </summary>
            AuthorName=2,
            /// <summary>
            /// 类别
            /// </summary>
            Category=3,
            /// <summary>
            /// 综合
            /// </summary>
            General=4
        }

        /// <summary>
        /// 站点
        /// </summary>
        public enum Site
        {
            /// <summary>
            /// 起点
            /// </summary>
            qidian = 1,
            /// <summary>
            /// 起点女生频道
            /// </summary>
            qdmm = 2,
            /// <summary>
            /// 晋江文学城
            /// </summary>
            jjwxc = 3,
            /// <summary>
            /// 17k小说
            /// </summary>
            yqk = 4,
            /// <summary>
            /// 小说阅读
            /// </summary>
            readnovel = 5,
            /// <summary>
            /// 来文学小说网
            /// </summary>
            laiwx = 6,
            /// <summary>
            /// 闪舞小说
            /// </summary>
            swxs = 7,
            /// <summary>
            /// 千载中文网
            /// </summary>
            qianzai = 8
        }

        private static List<SiteInfo> GetSiteList()
        {
            List<SiteInfo> t_list = new List<SiteInfo>();

            SiteInfo t_site = new SiteInfo();
            t_site.SiteId = 1;
            t_site.SiteName = "起点中文网";
            t_site.TableName = "qidian";
            t_site.SiteDomin = "http://www.qidian.com";
            t_list.Add(t_site);

            t_site = new SiteInfo();
            t_site.SiteId = 2;
            t_site.SiteName = "起点女生网";
            t_site.TableName = "qdmm";
            t_site.SiteDomin = "http://www.qdmm.com";
            t_list.Add(t_site);

            t_site = new SiteInfo();
            t_site.SiteId = 3;
            t_site.SiteName = "晋江文学城";
            t_site.TableName = "jjwxc";
            t_site.SiteDomin = "http://www.jjwxc.com";
            t_list.Add(t_site);

            t_site = new SiteInfo();
            t_site.SiteId = 4;
            t_site.SiteName = "一起看小说";
            t_site.TableName = "yqk";
            t_site.SiteDomin = "http://www.17k.com";
            t_list.Add(t_site);


            t_site = new SiteInfo();
            t_site.SiteId = 5;
            t_site.SiteName = "小说阅读";
            t_site.TableName = "readnovel";
            t_site.SiteDomin = "http://www.readnovel.com";
            t_list.Add(t_site);

            t_site = new SiteInfo();
            t_site.SiteId = 6;
            t_site.SiteName = "来文学小说网";
            t_site.TableName = "laiwx";
            t_site.SiteDomin = "http://www.laiwx.com";
            t_list.Add(t_site);

            t_site = new SiteInfo();
            t_site.SiteId = 7;
            t_site.SiteName = "闪舞小说";
            t_site.TableName = "swxs";
            t_site.SiteDomin = "http://www.35xs.com";
            t_list.Add(t_site);

            t_site = new SiteInfo();
            t_site.SiteId = 8;
            t_site.SiteName = "千载小说";
            t_site.TableName = "qianzai";
            t_site.SiteDomin = "http://www.qianzai.com";
            t_list.Add(t_site);

            return t_list;
        }

      

        /// <summary>
        /// 获取章节表名
        /// </summary>
        /// <param name="i_site_id"></param>
        /// <returns></returns>
        public static string GetTableName(int i_site_id)
        {
            List<SiteInfo> t_list = GetSiteList();

            string t_table_name = string.Empty;

            foreach (SiteInfo t_site in t_list)
            {
                if (t_site.SiteId == i_site_id)
                {
                    t_table_name = t_site.TableName;
                    break;
                }
            }

            return t_table_name;
        }

        /// <summary>
        /// 获取站点名称
        /// </summary>
        /// <param name="i_site_id"></param>
        /// <returns></returns>
        public static string GetSiteName(int i_site_id)
        {
            List<SiteInfo> t_list = GetSiteList();

            string t_site_name = string.Empty;

            foreach (SiteInfo t_site in t_list)
            {
                if (t_site.SiteId == i_site_id)
                {
                    t_site_name = t_site.SiteName;
                    break;
                }
            }

            return t_site_name;
        }

      
    }
}
